//
//  mediatype.m
//  OpenglPing
//
//  Created by 100TV protocal on 12-11-29.
//
//

#import "mediatype.h"
#import <Foundation/Foundation.h>

@implementation mediatype
+ (NSArray*)audioFormatExt{
    return [NSArray arrayWithObjects:@"mp3", @"wma", @"wave", @"wav", @"caf", @"ogg",
            @"ape", @"flac", @"vqf", nil];
}

+ (NSArray*)videoFormatExt{
    return [NSArray arrayWithObjects:@"3gp", @"mp4", @"wmv", @"avi", @"mov", @"mkv",
            @"fv", @"flv", @"rmvb", @"f4v", @"mpg", @"3g2", @"3gpp", @"m3u8", @"mpeg",
            @"rm", @"tp", @"ts", @"vob", nil];
}

+ (NSInteger)mediaFormat:(NSString*)filePath {
    kMediaFormat format;
    if ([[mediatype audioFormatExt] containsObject:[[filePath pathExtension] lowercaseString]]) {
        format = kAudioFormat;
    } else if ([[mediatype videoFormatExt] containsObject:[[filePath pathExtension] lowercaseString]]) {
        format = kVideoFormat;
    } else {
        format = kUnsupportFormat;
    }
    return format;
}
@end
